# 本模块主要负责生成click命令
from exts import db
from model.models import DishType,Dish,Desk
import click


def create_dish_type():
    dish_types = ['炒菜','汤菜']
    for item in dish_types:
        dish_type = DishType(dish_name=item)
        db.session.add(dish_type)

    db.session.commit()
    click.echo("菜品数据生成成功!")


def create_dish():
    dish1 = Dish(dish_name='农家小炒肉',price=22.0,dish_type_no=1)
    dish2 = Dish(dish_name='酸菜豆米汤',price=16.0,dish_type_no=2)
    dish3 = Dish(dish_name='酸辣土豆丝', price=12.0, dish_type_no=1)
    db.session.add_all([dish1,dish2,dish3])
    db.session.commit()
    click.echo('菜数据生成成功!')


def create_desk():
    desk1 = Desk(desk_name='1号桌',men=4)
    desk2 = Desk(desk_name='2号桌',men=4)
    db.session.add_all([desk1,desk2])
    db.session.commit()
    click.echo('桌子数据生成成功!')
